<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:comps="http://java.sun.com/jsf/composite/components">
	
<h:panelGroup layout="block" styleClass="conteudo">
	
	<h:panelGrid columns="2" styleClass="blogGrid" 
		columnClasses="blogGridEsquerda blogGridVerticalAlignTop, blogGridDireita blogGridVerticalAlignTop">
	
		<h:panelGroup id="posts">
		
			<h:form id="postsForm">
				
				<p:dataList id="postsList"
					styleClass="postsDataList" 
					var="post" value="#{BlogBean.posts}"
					paginator="true" paginatorAlwaysVisible="true" paginatorPosition="bottom"
					rows="5"
					type="none">
					
					<h:panelGroup id="postIndividual" layout="block" styleClass="postGeralItem">
						
						<h:panelGroup layout="block">
							<h:commandLink id="acessarPostBtn"
								styleClass="postGeralLink"
								action="#{BlogBean.exibirPost(post)}"
								ajax="false">
								<h:outputText value="#{post.titulo}" />
							</h:commandLink>
						</h:panelGroup>
						
						<h:panelGroup layout="block" styleClass="postGeralAutorData">
							<h:outputText value="Por #{post.autor.nome}, em " />
							<h:outputText value="#{post.data}">
								<f:convertDateTime pattern="EEEE, dd 'de' MMMM 'de' yyyy" />
							</h:outputText>					
						</h:panelGroup>
						
						<h:panelGroup layout="block"
							rendered="#{post.conteudo.length() gt 2000}">
	
							<h:panelGroup layout="block" 
								styleClass="postGeralTexto">
								<h:outputText value="#{post.conteudoResumo}" escape="false" />
							</h:panelGroup>
														
						</h:panelGroup>
						
						<h:panelGroup layout="block" 
							rendered="#{post.conteudo.length() lt 2001}"
							styleClass="postGeralTexto">
							<h:outputText value="#{post.conteudo}" escape="false" />	
						</h:panelGroup>	
					
						<h:panelGroup layout="block"
							styleClass="postGeralRodape">
							
							<h:panelGrid columns="5">
							
								<h:outputText value="#{locale['blog.post.opcoes']}" />
								
								<p:spacer width="5" />
													
								<p:commandButton id="lerMaisBtn"
									rendered="#{post.conteudo.length() gt 2000}"
									style="font-size: 80% !important;"
									icon="ui-icon-document"
									value="#{locale['blog.post.lerMais']}"
									ajax="false"
									action="#{BlogBean.exibirPost(post)}" />
									
								<p:spacer width="5" />
										
								<p:commandButton id="imprimirPostBtn" 
									style="font-size: 80% !important;"
									type="button"
									icon="ui-icon-print"
									value="#{locale['blog.post.imprimir']}">
									<p:printer target="postIndividual" />
								</p:commandButton>
							
							</h:panelGrid>

						</h:panelGroup>	
					
					</h:panelGroup>					
				
				</p:dataList>				
			
			</h:form>
		
		</h:panelGroup>
		
		<ui:include src="/resources/templates/blog/navegacaoBlogTemplate.xhtml" />
		
	</h:panelGrid>
		
</h:panelGroup>	

</ui:composition>